package cn.java86.myschool.web;

import cn.java86.myschool.dao.GradeDao;
import cn.java86.myschool.entity.Grade;
import cn.java86.myschool.entity.Page;
import cn.java86.myschool.service.GradeServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author oldliu
 * @since 1.0
 */
@RestController
@RequestMapping("grade")
public class GadeController {
    @Autowired
    private GradeServiceI gradeService;

    @GetMapping("list")
    public Page<Grade> list(
            @RequestParam(name = "pageNo",defaultValue = "1") int pageNo,
            @RequestParam(name = "pageSize",defaultValue = "10") int pageSize,
            @RequestParam(name = "gname",required = false) String gname) {
        Page<Grade> p = gradeService.paging(pageNo, pageSize, gname);
        return p;
    }
}
